﻿using System.Data.Entity.ModelConfiguration;


namespace InvestmentIntelligence.DbModel.Models.Mapping
{
    public class LogEntryMap : EntityTypeConfiguration<LogEntry>
    {
        public LogEntryMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Data);
            this.Property(t => t.Date)
                .IsRequired();
            this.Property(t => t.Identity)
                .IsRequired()
                .HasMaxLength(50);
            this.Property(t => t.StateId)
                .IsRequired();
            this.Property(t => t.TypeId)
                .IsRequired();

            // Table & Column Mappings
            this.ToTable("LogEntry", "Reports");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Data).HasColumnName("Data");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Identity).HasColumnName("Identity");
            this.Property(t => t.StateId).HasColumnName("StateId");
            this.Property(t => t.TypeId).HasColumnName("TypeId");
        }
    }
}
